#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory

echo "Cleaning..."

# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions

# Participant 1: Fluid
Participant1="Fluid"
cd ${Participant1}
    # Clean the case
    cleanCase
    # Create an empty .foam file for ParaView
    # Note: ".foam" triggers the native OpenFOAM reader of ParaView.
    # Change to ".OpenFOAM" to use the OpenFOAM reader provided with OpenFOAM.
    touch ${Participant1}.foam
cd ..
# Remove the log files
rm -fv ${Participant1}*.log

# Participant 2: Solid
Participant2="Solid"
cd ${Participant2}
    # Clean the case
	rm -fv *.nam
	rm -fv *.msh
    rm -fv *.log
    rm -fv flap.cvg
    rm -fv flap.dat
    rm -fv flap.frd
    rm -fv flap.sta
cd ..
# Remove the log files
rm -fv spooles.out
rm -fv ${Participant2}.log

# Remove the preCICE-related log files
echo "Deleting the preCICE log files..."
rm -fv \
    precice-*.log \
    precice-postProcessingInfo.log \
    precice-*-events.json

# Output files for preCICE versions before 1.2:
rm -fv \
    iterations-${Participant1}.txt iterations-${Participant2}.txt \
    convergence-${Participant1}.txt convergence-${Participant2}.txt \
    Events-${Participant1}.log Events-${Participant2}.log \
    EventTimings-${Participant1}.log EventTimings-${Participant2}.log

# Remove the preCICE address files
rm -rfv precice-run
rm -fv .*.address

echo "Cleaning complete!"
#------------------------------------------------------------------------------
